/**
 * 
 */
package com.QBsoft.commons.resources;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 * @author aquingaluisa
 *
 */
public class WsResourcesConexion {

	private static ResourceBundle RESOURCE_BUNDLE ;
	
	public WsResourcesConexion() throws MalformedURLException{
		File file = new File(WsResources.getString("com.QBsoft.pathExterno.properties"));
		URL[] urls = {file.toURI().toURL()};
		ClassLoader loader = new URLClassLoader(urls);
		RESOURCE_BUNDLE = ResourceBundle.getBundle(WsResources.getString("com.QBsoft.nombreArchivoExterno.properties"), Locale.getDefault(), loader);
	}
	/**
	 * Permite obtener un valor string (key)
	 * @param key
	 * @throws MissingResourceException
	 */
	public  String getString(String key) throws MissingResourceException{
		return RESOURCE_BUNDLE.getString(key);
	}
	
	/**
	 * Permite obtener un valor Integer (key)
	 * @param key
	 * @throws MissingResourceException
	 */
	public  Integer getInteger(String key) throws MissingResourceException{
		return Integer.valueOf(RESOURCE_BUNDLE.getString(key));
	}
}
